package com.dmw.service.impl;

import com.dmw.dao.DmSchedulerSeatDao;
import com.dmw.entity.DmSchedulerSeat;
import com.dmw.service.DmSchedulerSeatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 排期座位表(DmSchedulerSeat)表服务实现类
 *
 * @author makejava
 * @since 2021-03-19 00:31:58
 */
@Service("dmSchedulerSeatService")
public class DmSchedulerSeatServiceImpl implements DmSchedulerSeatService {
    @Resource
    private DmSchedulerSeatDao dmSchedulerSeatDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public DmSchedulerSeat queryById(Long id) {
        return this.dmSchedulerSeatDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<DmSchedulerSeat> queryAllByLimit(int offset, int limit) {
        return this.dmSchedulerSeatDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param dmSchedulerSeat 实例对象
     * @return 实例对象
     */
    @Override
    public DmSchedulerSeat insert(DmSchedulerSeat dmSchedulerSeat) {
        this.dmSchedulerSeatDao.insert(dmSchedulerSeat);
        return dmSchedulerSeat;
    }

    /**
     * 修改数据
     *
     * @param dmSchedulerSeat 实例对象
     * @return 实例对象
     */
    @Override
    public DmSchedulerSeat update(DmSchedulerSeat dmSchedulerSeat) {
        this.dmSchedulerSeatDao.update(dmSchedulerSeat);
        return this.queryById(dmSchedulerSeat.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.dmSchedulerSeatDao.deleteById(id) > 0;
    }
}
